package com.secneo.appshare.common;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.secneo.appshare.api.LocalStore;

public class AppSharePreference {
	public static final String USER_ID = "user_id";
	public static final String PUSH_STATUS = "push_status";
	public static final String SEND_APPMDSHA_STATUS = "send_appmdsha_status";
	public static final String SEND_APPALL_STATUS = "send_appall_status";
	
	public static final boolean isAppShareUserLogined(Context c) {
		return LocalStore.getLocaleStoreInstance().thereIsAccountLogin();
	}

	public static final void setAppShareUserLogined(Context c, boolean enabled) {
		final SharedPreferences sp = PreferenceManager
				.getDefaultSharedPreferences(c);
		SharedPreferences.Editor editor = sp.edit();
		editor.putBoolean(USER_ID, enabled);
		editor.commit();
	}
	
	

	public static final boolean isAppSharePushStatus(Context c) {
		final SharedPreferences sp = PreferenceManager
		.getDefaultSharedPreferences(c);
        boolean l = sp.getBoolean(PUSH_STATUS, false);
        return l;
	}

	public static final void setAppSharePushStatus(Context c, boolean enabled) {
		final SharedPreferences sp = PreferenceManager
				.getDefaultSharedPreferences(c);
		SharedPreferences.Editor editor = sp.edit();
		editor.putBoolean(PUSH_STATUS, enabled);
		editor.commit();
	}


	public static final boolean isAppMdShaStatus(Context c) {
		final SharedPreferences sp = PreferenceManager
		.getDefaultSharedPreferences(c);
        boolean l = sp.getBoolean(SEND_APPMDSHA_STATUS, false);
        return l;
	}

	public static final void setAppMdShaStatus(Context c, boolean enabled) {
		final SharedPreferences sp = PreferenceManager
				.getDefaultSharedPreferences(c);
		SharedPreferences.Editor editor = sp.edit();
		editor.putBoolean(SEND_APPMDSHA_STATUS, enabled);
		editor.commit();
	}
	
	public static final boolean isAppallStatus(Context c) {
		final SharedPreferences sp = PreferenceManager
		.getDefaultSharedPreferences(c);
        boolean l = sp.getBoolean(SEND_APPALL_STATUS, false);
        return l;
	}

	public static final void setAppallStatus(Context c, boolean enabled) {
		final SharedPreferences sp = PreferenceManager
				.getDefaultSharedPreferences(c);
		SharedPreferences.Editor editor = sp.edit();
		editor.putBoolean(SEND_APPALL_STATUS, enabled);
		editor.commit();
	}
}